//
//  CTHeaderView.m
//  digitalCurrency
//
//  Created by 默认账户 on 2019/6/1.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "CTHeaderView.h"
#import "JKBannarView.h"
#import "HFFanClubJoinRollView.h"


@implementation CTHeaderView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self makeViews];
    }
    return self;
}

- (void)makeViews {
    __weak typeof(self) weakSelf = self;

    self.bannerView = [[JKBannarView alloc]initWithFrame:CGRectMake(0, 10, kWindowW, 195) viewSize:CGSizeMake(kWindowW,195)];
    self.bannerView.backgroundColor = [UIColor blackColor];
    [self addSubview:self.bannerView];
    
    self.bannerView.items = @[@"https://www.baidu.com",@"https://www.baidu.com"];
    
    UIView *zBottomView = [[UIView alloc]init];
    [self addSubview:zBottomView];
    [zBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(16);
        make.right.equalTo(-16);
        make.height.equalTo(49);
        make.bottom.equalTo(-10);
    }];
    zBottomView.backgroundColor = [UIColor colorWithHexStr:maincolor alpha:0.05];
    zBottomView.layer.masksToBounds = YES;
    zBottomView.layer.cornerRadius = 5.0;
    
    UIImageView *tipsImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"z_tongzhi"]];
    [zBottomView addSubview:tipsImg];
    [tipsImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(12);
        make.centerY.mas_equalTo(0);
        make.width.height.mas_equalTo(13);
    }];
    
    UILabel *tipsLB = [[UILabel alloc]init];
    [zBottomView addSubview:tipsLB];
    [tipsLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(32);
        make.centerY.equalTo(0);
    }];
    tipsLB.font = kFont(14);
    tipsLB.text = LocalizationKey(@"公告");
    tipsLB.textColor = tMainColor;
    
//    _time = [[UILabel alloc] init];
//    _time.text = @"06-06";
//    _time.textColor = [UIColor whiteColor];
//    _time.font = [UIFont systemFontOfSize:12];
//    _time.textAlignment = NSTextAlignmentRight;
//    [self addSubview:_time];
//    [_time mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.mas_equalTo(-12);
//        make.bottom.mas_equalTo(-15);
//        make.height.mas_equalTo(12);
//    }];
    
    _rollView = [[HFFanClubJoinRollView alloc]init];
    [_rollView setNewsTextColor:tMainColor];
    [_rollView setNewsFont:[UIFont systemFontOfSize:12]];
    [_rollView setRollViewBlock:^(NSInteger index) {
        if (weakSelf.MainTopViewBlock != nil) {
            weakSelf.MainTopViewBlock(1, index);
        }
    }];
    [zBottomView addSubview:_rollView];

    [_rollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(66);
        make.right.equalTo(40);
        make.height.mas_equalTo(49);
    }];
    
    _pointGold = [UIButton buttonWithType:UIButtonTypeCustom];
    _pointGold.layer.cornerRadius = 15;
    _pointGold.backgroundColor = [UIColor colorWithHEX:maincolor];
    [_pointGold setTitle:LocalizationKey(@"Node race") forState:UIControlStateNormal];
    _pointGold.titleEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 10);
    [_pointGold setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    _pointGold.titleLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:_pointGold];
    [_pointGold mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(13);
        make.right.mas_equalTo(25);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(110);
    }];
    
    self.bannerView.hidden = YES;
    self.pointGold.hidden = YES;
}

@end
